package com.micheal.pattern.factory.simple;

import com.micheal.pattern.factory.Apple;
import com.micheal.pattern.factory.Huawei;
import com.micheal.pattern.factory.Phone;
import com.micheal.pattern.factory.SanXing;

/**
 * Created by micheal on 2018/3/21/0021.
 */
public class SimpleFactory {

    public Phone getPhone(String name){
        if("三星".equals(name)){
            return new SanXing();
        }else if("苹果".equals(name)){
            return new Apple();
        }else if("华为".equals(name)){
            return new Huawei();
        }else{
            System.out.println("此类型不能支持！");
            return null;
        }
    }

}
